package work20241203_chap6oop.n_demo11;

/**
 * @author zdl
 * @date 2024/12/5
 */
public class Circle extends Shape {
    private double r;

    public Circle() {
    }

    public Circle(double r) {
        this.r = r;
    }

    @Override
    public double area() {
        double a = r * r * 3.14;
        System.out.println("圆形面积:" + a);
        return a;
    }

    @Override
    public double girth() {
        double b = 2 * 3.14 * r;
        System.out.println("圆形周长:" + b);
        return b;
    }

    /**
     * 获取
     * @return r
     */
    public double getR() {
        return r;
    }

    /**
     * 设置
     * @param r
     */
    public void setR(double r) {
        this.r = r;
    }

    public String toString() {
        return "Circle{r = " + r + "}";
    }
}
